using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace SalonPay.DAL
{   
    public class BaseProcedure
    {
        protected static string _ConnString;
        protected string spName = "";
        protected SqlParameter[] Parameters;

        protected string ConnString
        {
            get
            {
                if (_ConnString == null)
                {
                    lock (this)
                    {
                        if (_ConnString == null)
                        {
                            _ConnString = ConfigurationManager.AppSettings["ConnString"];
                        }
                    }
                }
                return _ConnString;
            }
        }

        public int ExecuteNonQuery()
        {
            return SqlHelper.ExecuteNonQuery(ConnString, CommandType.StoredProcedure, spName, Parameters);
        }

        public DataSet ExecuteDataset()
        {
            return SqlHelper.ExecuteDataset(ConnString, CommandType.StoredProcedure, spName, Parameters);
        }
    }
}
